
from lib import log
from lib.console import cmessage

class CommandHandler(object):
	
	def __init__(self, commandHandler, world):
		self._commandHandler = commandHandler
		self._world = world
	
	@property
	def world(self): return self._world
	
	def playerHelp(self, player):
		cmessage(player, "help: monster <name>")
	
	def processVerbFromPlayer(self, verb, player, fullCommand):
		if len(fullCommand) != 2:
			self.playerHelp(player)
		else:
			full_path = "objects." + fullCommand[1]
			object_class = self.world.loadObject(full_path)
			if object_class is not None:
				obj = object_class(player.location, self.world)
				self.world.addObject(obj)
